<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Windows对象</title>

</head>
<body>
<input type="button" id="openBtn" value="打开窗口">
<input id = "closeBtn" type="button" value="关闭窗口">
<script>
        /*var flag = confirm("您是否已满18周岁?");
        if(flag)
        {
            alert("臭小子一天天想什么呢?");
        }
        else
        {
            alert("还挺纯的");
        }*/

        /*var result = prompt("你多少岁了?");
        alert(result);
        //如果点取消返回null*/

        var openBtn = document.getElementById("openBtn");
        var newWindow;
        openBtn.onclick = function(){
            //打开新窗口
            newWindow = open("https://www.bilibili.com");
            //这个有返回值的
        }
        var closeBtn = document.getElementById("closeBtn");
        closeBtn.onclick = function(){
            //关闭浏览器当前窗口
           newWindow. close();
            //谁调用我我关谁
            //所以要用open的返回对象来调用
        }
    </script>
</body>
</html>